
import axios from 'axios';

/**
 * 商品销售规格
 */
export class SpecificationService {
    // 分页查询列表
    static findSpecifications (queryParams) {
        return axios({
            url: '/mall/good/Specification/findSpecifications',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的商品销售规格
    static findSpecification (specificationId) {
        const query = {
            specificationId
        }
        return axios({
            url: '/mall/good/Specification/findSpecification',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品销售规格(包含外键名称)
    static findSpecificationForView (specificationId) {
        const query = {
            specificationId
        }
        return axios({
            url: '/mall/good/Specification/findSpecificationForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品销售规格(包含外键名称)
    static findSpecificationForEdit (specificationId) {
        const query = {
            specificationId
        }
        return axios({
            url: '/mall/good/Specification/findSpecificationForEdit',
            method: 'POST',
            params: query,
        });
    }
  //根据商品ID查询指定的商品销售规格(包含外键名称)
  static findSpecificationByCommodityId (commodityId) {
    const query = {
      commodityId
    }
    return axios({
      url: '/mall/good/Specification/findSpecificationsByCommodityId',
      method: 'POST',
      params: query,
    });
  }

    //根据ID查询指定的商品销售规格(只提取ID 和 Name)
    static findSpecificationsWithIdNameById (specificationId) {
        const query = {
            specificationId
        }
        return axios({
            url: '/mall/good/Specification/findSpecificationsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询商品销售规格集合(只提取ID 和 Name)
    static findSpecificationsWithIdNameByName (specificationName) {
        const query = {
            specificationName
        }
        return axios({
            url: '/mall/good/Specification/findSpecificationsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存商品销售规格
    static saveSpecification (specification) {
        const query = {}
        return axios({
            url: '/mall/good/Specification/saveSpecification',
            method: 'POST',
            params: query,
            data: specification
        });
    }

    //修改保存商品销售规格
    static updateSpecification (specification) {
        const query = {}
        return axios({
            url: '/mall/good/Specification/updateSpecification',
            method: 'POST',
            params: query,
            data: specification
        });
    }

    //根据ID查询指定的商品销售规格(只提取ID 和 Name)
    static deleteSpecification (specificationId) {
        const query = {
            specificationId
        }
        return axios({
            url: '/mall/good/Specification/deleteSpecification',
            method: 'POST',
            params: query,
        });
    }
}
